package myutil;

/**
 * @author jkamaraj
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */

import java.io.*;
public class MyInput
{
	public static String readString()
  	{
		String str="";
		while(true)
		{
		  	try
			{
				BufferedReader in = new BufferedReader(
					new InputStreamReader(System.in));
				str=in.readLine();
				return str;
			}
			catch(java.io.IOException e)
			{ 
				System.out.println(e.getCause());
				System.out.println(e.getMessage());
				System.out.println(e.getLocalizedMessage());
			}
		}
	}
	public static int readInt()
 	{
		while(true)
     	{
			try
        	{
				return Integer.parseInt(readString().trim());
			}
			catch(NumberFormatException e)
        	{
				System.out.println("Not an integer");
			}
		}
	}
    
	public static double readDouble()
 	{
		while(true)
		{
			try
			{
				return Double.parseDouble(readString().trim());
			}
        	catch(NumberFormatException e)
         {
				System.out.println("Not a floating point number");
			}
		}
	}
}
